home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / mouclib5 / mouselib.h < prev    next >
Text File  |  1995-11-01  |  6KB  |  129 lines

  1. /**************************************************************************
  2. *         MODULE NAME:        MOUSELIB                                    *
  3. **************************************************************************/
  4.  
  5. #define    MOUSEINT               0x33  /* mouse driver interrupt */
  6. #define    LEFTBUTTON               1   /* bit 0 */ 
  7. #define    RIGHTBUTTON              2   /* bit 1 */  
  8. #define    MIDDLEBUTTON             4   /* bit 2 */
  9.  
  10. #define    CURSOR_LOCATION_CHANGED  1   /* event mask bits */
  11. #define    LEFT_BUTTON_PRESSED      2  
  12. #define    LEFT_BUTTON_RELEASED     4  
  13. #define    RIGHT_BUTTON_PRESSED     8
  14. #define    RIGHT_BUTTON_RELEASED    16 
  15. #define    MIDDLE_BUTTON_PRESSED    32 
  16. #define    MIDDLE_BUTTON_RELEASED   64 
  17.  
  18. #define    click_repeat   10  /* Recommended value for waitForRelease timeOut */
  19.  
  20. struct box {
  21.         unsigned left   ;
  22.         unsigned top    ;
  23.         unsigned right  ;
  24.         unsigned bottom ;
  25.     } ; /* Do not change field order !!! */
  26.  
  27. struct grCursorType {
  28.      char xH,yH       ;               /* x,y Hot Point */
  29.      unsigned  *data  ;         /* cursor look pointer */
  30.  } ;
  31.  
  32. typedef unsigned int u_int;
  33. enum mouseType   {twoButton,threeButton,another};
  34. enum buttonState {buttonDown,buttonUp};
  35. enum direction   {moveRight,moveLeft,moveUp,moveDown,noMove};
  36. enum boolean     {FALSE, TRUE};
  37.  
  38. /* External variable (can be used by user) */
  39.  
  40. extern unsigned interceptX, interceptY ;
  41. extern void far (*interrupt OldExitProc)(void);
  42. extern enum boolean  mouse_present    ;
  43. extern enum mouseType  mouse_buttons  ;
  44. extern unsigned  eventX,eventY,eventButtons ; /* any event handler should update */
  45. extern enum boolean eventhappened  ;        /* these vars to use getLastEvent   */
  46. extern unsigned XMotions, YMotions ;        /*          per 8 pixels            */
  47.  
  48. extern unsigned data ;            /* data segment (DS) */
  49.  
  50. extern struct box HideBox ;             /* Do not change field order !!! */
  51. extern struct REGPACK reg ;             /* general registers used */
  52. extern struct SREGS sreg ;              /* segment registers */
  53.  
  54. extern int grMode,grDrv   ;             /* detect graphic mode if any */
  55. extern int grCode         ;             /* return initgraph code in here */
  56.  
  57. extern signed int mouseCursorLevel ;        /* if > 0 mouse cursor is visiable,
  58.                                         otherwise not, containes the level
  59.                                         of showMouseCursor/hideMouseCursor */
  60.  
  61. extern void far interrupt (*lastHandler)(void) ; /* when changing the interrupt
  62.                                              handler temporarily, save BEFORE
  63.                                              the change these to variables,
  64.                                              and restore them when neccessary */
  65.  
  66. extern struct grCursorType lastCursor  ; /* when changing graphic cursor temporarily,
  67.                                      save these values BEFORE the change, and
  68.                                      restore when neccessary */
  69.  
  70.  
  71. /* ----------------- Function prototypes ----------------- */
  72.  
  73. void initMouse (void)                       ; /* when replacing mouse mode do that..! */
  74. void doMouse(void)                          ;
  75. void showMouseCursor (void)                 ;
  76. void hideMouseCursor (void)                 ;
  77. unsigned getMouseX (void)                   ;
  78. unsigned getMouseY (void)                   ;
  79. enum buttonState getButton(char Button)     ;
  80. enum boolean buttonPressed (void)           ;
  81. void setMouseCursor(unsigned x,unsigned y)  ;
  82. unsigned LastXPress(char Button)            ;
  83. unsigned LastYPress(char Button)            ;
  84. unsigned ButtonPresses(char Button)         ; /* from last last check */
  85. unsigned LastXRelease(char Button)          ;
  86. unsigned LastYRelease(char Button)          ;
  87. unsigned ButtonReleases(char Button)        ; /* from last last check */
  88. void mouseBox(unsigned left,unsigned top,
  89.               unsigned right,unsigned bottom) ; /* limit mouse rectangle */
  90. void graphicMouseCursor(char xHotPoint,char yHotPoint, unsigned *dataOfs)  ;
  91. void HardwareTextCursor(char fromLine,char toLine)    ;
  92. void softwareTextCursor(unsigned screenMask,unsigned cursorMask)  ;
  93. enum direction recentXmovement (void)       ;
  94. enum direction recentYmovement (void)       ;
  95. void setArrowCursor (void)                  ;
  96. void setEventHandler (unsigned mask ,void interrupt (*handler)());
  97. void far interrupt defaultHandler (void);
  98. enum boolean GetLastEvent(unsigned *x, unsigned *y, enum buttonState *left_button,
  99.              enum buttonState *right_button, enum buttonState *middle_button);
  100. void setDefaultHandler (unsigned mask);
  101. void setWatchCursor (void)                  ;
  102. void setNewWatchCursor (void)               ;
  103. void setUpArrowCursor (void)                ;
  104. void setLeftArrowCursor (void)              ;
  105. void setCheckMarkCursor (void)              ;
  106. void setPointingHandCursor (void)           ;
  107. void setDiagonalCrossCursor (void)          ;
  108. void setRectangularCrossCursor (void)       ;
  109. void setHourGlassCursor (void)              ;
  110. void setDefaultHandler(unsigned mask)               ;
  111. void enableLightPenEmulation (void)                 ;
  112. void disableLightPenEmulation (void)                ;
  113. void defineSensetivity(unsigned x,unsigned y)       ;
  114. void setHideCursorBox(unsigned left,unsigned top,
  115.                       unsigned right,unsigned bottom)  ;
  116. void defineDoubleSpeedTreshHold(unsigned treshHold)    ;
  117. void disableTreshHold (void)                           ;
  118. void defaultTreshHold (void)                           ;
  119. void setMouseGraph (void)                              ;
  120. void resetMouseGraph (void)                            ;
  121. void waitForRelease(unsigned timeOut)                  ;
  122. void swapEventHandler (unsigned mask ,void far interrupt (*handler)());
  123. int getMouseSaveStateSize (void);
  124. void interceptMouse (void);
  125. void restoreMouse (void);
  126. void MyExitProc (void);
  127.  
  128.  
  129.